package com.crazymaker.springcloud.seckill.remote.client;

import com.alibaba.fastjson.JSONObject;
import com.crazymaker.springcloud.common.result.RestOut;
import com.crazymaker.springcloud.seckill.remote.fallback.DemoDefaultFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @description:远程服务的本地声明式接口
 */

@FeignClient(
        value = "seckill-provider", path = "/api/demo/",
        fallback = DemoDefaultFallback.class)
public interface DemoClient
{
    /**
     * 测试远程调用
     *
     * @return hello
     */
    @GetMapping("/hello/v1" )
    RestOut<JSONObject> hello();

    /**
     * 非常简单的一个 回显 接口，主要用于远程调用
     *
     * @return echo 回显消息
     */
    @RequestMapping(value = "/echo/{word}/v1",
            method = RequestMethod.GET)
    RestOut<JSONObject> echo(
            @PathVariable(value = "word" ) String word);

}
